package com.wf.controller;


import com.wf.pojo.Order;
import com.wf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    OrderService orderService;

    /**
     * 根据订单id查询订单记录
     */
    @GetMapping("/{orderID}")
    public Order getById(@PathVariable Long orderID){
        Order order = orderService.getById(orderID);
        return order;
    }

    /**
     * 添加新的订单
     */
    @PostMapping("/{goodsId}")
    public String insert(@PathVariable Long goodsId){
        orderService.insert(goodsId);
        return "OK";
    }



}
